import {request} from "../utils/axios";

// 导入Data类型和参数类型
import type {LoginParams, RegisterParams, UserInfo} from "../types/user";
import type {Data} from "../utils/axios";

// 认证相关接口
export const authApi = {
    // 登录
    login: (params: LoginParams): Promise<Data<UserInfo>> => {
        return request<UserInfo>("/auth/login", "POST", params);
    },

    // 注册
    register: (params: RegisterParams): Promise<Data<object>> => {
        return request<object>("/user/register", "POST", params);
    },
};
